<%-- 
    Document   : removeCliente
    Created on : Nov 13, 2011, 12:18:29 AM
    Author     : Jun
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
   
    <body><div id="container"><div id="content">
        <%@include file="topo.jsp" %>
        <%@ page import="br.objetos.*, java.util.*" %>
        
        <table border="0" cellspacing="5" cellpadding="5" width="100%">
            <tr>
                <th>
                    <%@include file="abalateral.jsp" %>
                </th>
            </tr><tr>
                <th>
                    <h1>Remoção de Cliente</h1>
                    <p>
                         <form action="buscaClienteDo.jsp?estado=remover" method="post">
                        Filtro: <input type="text" name="filtro" size="30"/> 
                            <input type="submit" value="Buscar" />
                         </form>
                    </p>
                    <%
                        ClienteMetodos c = new ClienteMetodos();
                        if (request.getParameter("inserted") != null) {
                            c = (ClienteMetodos) session.getAttribute("cliente");
                   
                        }
                        if (request.getParameter("insertedClienteRemovido") != null) {
                    %>
                    <p>Cliente removido com sucesso.</p>
                    <%
                        }
                    %>
                    <table border="1" cellspacing="2">
                        <thead>
                            <tr>
                                <th>Nome Cliente</th>
                                <th>CPF</th>
                                <th>TELEFONE</th>
                            </tr>
                        </thead>
                        <tbody>
                            <%
                                        
                                        
                                        if (!c.getMensagem().equals("")){
                                            out.println(c.getMensagem());
                                        }else {
                                            List listaC = new ArrayList();
                                            listaC = c.getListaClientes();
                                            for (Iterator it = listaC.iterator(); it.hasNext();) {
                                                Cliente cli = (Cliente) it.next();
                            %>
                            <form action="removeClienteDo.jsp?id=<%= cli.getIdCliente() %>" method="post">
                            <tr>
                                <th>
                                    <%=cli.getPessoa().getNome() %>
                                    </a>
                                </th>
                                <th>
                                    <%=cli.getPessoa().getCpf()%>
                                </th>
                                 <th>
                                    <%=cli.getPessoa().getTelefone()%>
                                </th>
                                <th>
                                    <input type="submit" value="Remover" />
                                </th>

                            </tr>
                            </form>

                            <%
                                            }
                                        }
                            %>
                        </tbody>
                    </table>
                </th>
            </tr>
        </table>
        
    </div><div id="footer" align="center"><%@include file="footer.jsp" %></div></div></body>
</html>
